package com.ecommerce.dal.common;

import java.util.Date;

import com.ecommerce.dal.entity.Admin;
import com.ecommerce.dal.service.impl.AdminManagerService;

public class TestAdmin {

	public TestAdmin(AdminManagerService adminManagerService) {
		Admin admin = new Admin();
		//Increment
    	long id = 4L;
    	admin.setFirstName("admin"+id);
    	admin.setUserName("admin"+id);
    	admin.setPassword("123");
    	admin.setLastName("admin"+id);
    	admin.setNewsletter(true);
    	admin.setBirthDate(new Date());
    	admin.setGender("male");
    	admin.setJoinDate(new Date());
    	
    	adminManagerService.saveAdmin(admin);
    	
    	Admin admin2 = adminManagerService.retrieveAdmin(4L);
    	System.out.println(admin2);
    	admin2 = adminManagerService.retrieveAdmin("admin"+id, "123");
    	
    	/** update **/
    	admin2.setFirstName("ahmed");
    	adminManagerService.updateAdmin(admin2);
	}

}
